﻿using System;

namespace OpenLS.Spreadsheet.Formats.Biff
{
    static class EnumHelper
    {
        public static bool TryParse<T> (string value, out T result)where T: struct
        {
#if NET40
            return Enum.TryParse(value, true, out result);
#else
            try
            {
                result = (T) Enum.Parse(typeof (T), value);
                return true;
            }
            catch (Exception)
            {
                result = default(T);
                return false;
            }

#endif
        }
    }
}
